package com.scheduling.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.scheduling.common.annotation.Log;
import com.scheduling.common.core.controller.BaseController;
import com.scheduling.common.core.domain.AjaxResult;
import com.scheduling.common.enums.BusinessType;
import com.scheduling.system.domain.Schedulingstatus;
import com.scheduling.system.service.ISchedulingstatusService;
import com.scheduling.common.utils.poi.ExcelUtil;
import com.scheduling.common.core.page.TableDataInfo;

/**
 * 排班状态Controller
 * 
 * @author mj
 * @date 2025-05-07
 */
@RestController
@RequestMapping("/system/schedulingstatus")
public class SchedulingstatusController extends BaseController
{
    @Autowired
    private ISchedulingstatusService schedulingstatusService;

    /**
     * 查询排班状态列表
     */
    @PreAuthorize("@ss.hasPermi('system:schedulingstatus:list')")
    @GetMapping("/list")
    public TableDataInfo list(Schedulingstatus schedulingstatus)
    {
        startPage();
        List<Schedulingstatus> list = schedulingstatusService.selectSchedulingstatusList(schedulingstatus);
        return getDataTable(list);
    }

    /**
     * 导出排班状态列表
     */
    @PreAuthorize("@ss.hasPermi('system:schedulingstatus:export')")
    @Log(title = "排班状态", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Schedulingstatus schedulingstatus)
    {
        List<Schedulingstatus> list = schedulingstatusService.selectSchedulingstatusList(schedulingstatus);
        ExcelUtil<Schedulingstatus> util = new ExcelUtil<Schedulingstatus>(Schedulingstatus.class);
        util.exportExcel(response, list, "排班状态数据");
    }

    /**
     * 获取排班状态详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:schedulingstatus:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(schedulingstatusService.selectSchedulingstatusById(id));
    }

    /**
     * 新增排班状态
     */
    @PreAuthorize("@ss.hasPermi('system:schedulingstatus:add')")
    @Log(title = "排班状态", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Schedulingstatus schedulingstatus)
    {
        return toAjax(schedulingstatusService.insertSchedulingstatus(schedulingstatus));
    }

    /**
     * 修改排班状态
     */
    @PreAuthorize("@ss.hasPermi('system:schedulingstatus:edit')")
    @Log(title = "排班状态", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Schedulingstatus schedulingstatus)
    {
        return toAjax(schedulingstatusService.updateSchedulingstatus(schedulingstatus));
    }

    /**
     * 删除排班状态
     */
    @PreAuthorize("@ss.hasPermi('system:schedulingstatus:remove')")
    @Log(title = "排班状态", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(schedulingstatusService.deleteSchedulingstatusByIds(ids));
    }
}
